export default {
    install(Vue, options) {
        const components = require.context('@/components', true, /index.(vue)$/)
        console.log(components.keys())
        components.keys().forEach(item => {
            const component = components(item).default;
            if (component.name) {
                Vue.component(component.name, component)
            } else {
                this.installGroupComponent(Vue, component)
            }
        })
    },
    installGroupComponent(Vue, component) {
        Object.keys(components).forEach(key => {
            Vue.component(key, components[key])
        })
    }
}
